<template>
	<view class="">
		<view class="now">
			<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/rightsbanner.png" mode=""></image>
			<!-- 	<view class="now_contant">
				<view class="top">
					当前身份为
				</view>
				<view class="bot">
					非跑团会员
				</view>
			</view> -->
			<view class="now_contant">
				<view class="top">当前身份为</view>
				<view class="bot" v-if="club_info.Title == runTitle && club_info.VipUser != 2 && club_info.Checked">
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/VIP.png" mode=""></image>
					普通会员
				</view>
				<view class="bot" v-else-if="club_info.Title == runTitle && club_info.VipUser == 2 && club_info.Checked">
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/SVIP.png" mode=""></image>
					高级会员
				</view>
				<view class="bot" v-else-if="club_info.Title != runTitle">非跑团会员</view>
				<view class="bot" v-else-if="club_info.Title == runTitle && !club_info.Checked && club_info.VipUser != 2">审核中</view>
			</view>
		</view>
		<!-- v-if="runsetinfo.vip_open" -->
		<view class="joinsvip" v-if="runsetinfo.vip_open && club_info.Title == runTitle && club_info.Checked">
			<view class="pic">
				<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/mine_banner.png" mode=""></image>
				<view class="contant">
					<view class="left">
						<view class="price">高级会员：￥{{ runsetinfo.vip_price }}元/年</view>
						<view class="info">高级会员可以享受团报活动价</view>
					</view>
					<!-- 非会员状态 -->
					<view class="">
						<view class="right right_one" v-if="club_info.Title != runTitle">立即加入</view>
						<view class="right" v-else-if="club_info.Title == runTitle && club_info.VipUser == 0" @tap="join">立即加入</view>
						<view v-else-if="club_info.VipUser == 1 && runsetinfo.vip_verify" class="right right_three">审核中</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 会员权益 -->
		<view class="benefit" v-if="runsetinfo.inviol">
			<view class="benefit_content">
				会员权益
			</view>
		</view>
		<view class="about" v-if="runsetinfo.inviol">
			<view class="aboutContent" v-for="(item,key) in groupRights" :key="key">
				{{item}}
			</view>
		</view>
		<view class="modate" v-else>
			<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/discover/run_noactive.png" mode=""></image>
			<text>暂无数据</text>
		</view>
		<!-- loading 遮罩层 -->
		<loading v-if="loadflag"></loading>
		<navigation></navigation>
	</view>
</template>

<script>
import loading from '@/components/loading/loading.vue';
import navigation from '@/components/navigation/navigation.vue';
export default {
	components: { loading, navigation },
	data() {
		return {
			loadflag: true,
			vip_rank: '',
			club_id: '',
			runsetinfo: {},
			runTitle: '',
			club_info: {},
			groupRights: [],
			// 权益内容
			rights: [{ info: '贺卡几乎是发卡行发货hi hash发卡行反馈', index: 0 }, { info: '贺卡几乎是发卡行发货hi hash发卡行反馈', index: 1 }]
		};
	},
	onLoad(options) {
		this.runTitle = options.runtitle;
		this.club_id = options.id;
	},
	mounted() {
		this.jude_limit();
		this.runset();
	},
	methods: {
		// vip open 是否开启高级会员
		// vip_verify 是否开启高级会员审核
		// in_verify 是否需要填写表单
		// inviol 会员权益
		// 跑团配置
		runset() {
			this.ajax('club/clubSetting', {
				data: {
					club_id: this.club_id
				},
				success: res => {
					 // console.log (res);
					this.runsetinfo = res.msg;
					this.groupRights = res.msg.inviol.split('\n')
					//  // console.log (res.msg.inviol.split('\n'));
				}
			});
		},
		// 判断是不是会员 获取用户信息
		jude_limit() {
			this.ajax('user/userInfo', {
				success: res => {
					 // console.log (res);
					this.club_info = res.msg.club_info;
					this.loadflag = false;
				}
			});
		},
		join() {
			this.ajax('club/applyVipUser', {
				data:{
					club_id:this.club_id
				},
				success: res=> {
					 // console.log (res)
					this.jude_limit();
					this.runset();
				}
			})
			// uni.navigateTo({
			// 	url:'/pageB/run/joinsvip?clubid='+this.club_id
			// })
		},
		tosvip() {
			uni.navigateTo({
				url: '/pageB/discover/svip'
			});
			// this.$refs.popup.open()
		}
	}
};
</script>

<style lang="less" scoped>
@import url('../../static/less/pageB/discover/viprights.less');
</style>
<style>
page {
	background-color: #f2f2f2;
}
</style>
